package app.web.qk.controller;

import app.config.Config;
import cn.dev33.satoken.annotation.SaIgnore;
import com.gitee.feizns.quickstart.domain.vo.Ret;
import com.gitee.feizns.quickstart.log.Log;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 通用模块/全局配置
 * @author feizns
 * @since 2025/4/10
 */
@RestController
@RequestMapping("/api/v1/qk/config")
public class QkConfigController {

    /**
     * 公钥
     * @return {@link Ret }<{@link String }>
     */
    @SaIgnore
    @Log(type = "配置获取", value = "'获取公钥'")
    @GetMapping("/public-key")
    public Ret<String> publicKey() {
        return Ret.ok(Config.rsaPublicKey());
    }

    /**
     * 重新加载所有配置
     * @return {@link Ret }<{@link Void }>
     */
    @RequestMapping("/reload")
    public Ret<Void> reload() {
        return Ret.ok(Config::reload);
    }

}
